package cn.yshujia.handler.sensitive;

import cn.yshujia.encryption.AESEncrypt;
import cn.yshujia.utils.StringUtils;
import cn.yshujia.utils.WordReplaceUtils;
import com.github.houbb.sensitive.word.core.SensitiveWordHelper;

/**
 * @author yshujia
 * @create 2024/12/18
 * @description SensitiveHandler
 */

public class SensitiveHandler extends AbstractSensitiveHandler {
	
	WordReplaceUtils wordReplaceUtils = new WordReplaceUtils();
	
	@Override
	public String set(String s) {
		if (StringUtils.isEmpty(s)) {
			return null;
		}
		// 敏感词过滤
		String cipherText = SensitiveWordHelper.replace(s, wordReplaceUtils);
		return AESEncrypt.encrypt(cipherText);
	}
}


